package com.yanqu.road.server.cmd.newmonopolymkt.office;

import com.yanqu.road.entity.enums.eMonopolyMarketResType;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.newmonopolymkt.NewMonopolyMarketProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.newmonopolymkt.NewMonopolyMarketModule;
import com.yanqu.road.server.manger.systemgroup.newmonopolymarket.NewMonopolyMarketMgr;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.GameProtocol;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = GameProtocol.S_NEW_MONOPOLY_MARKET_OFFICE_ENTER, desc = "榷场 进入大宋榷署")
public class MonopolyMarketOfficeEnterCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        if(!NewMonopolyMarketMgr.canEnterSystem(player)){
            ret = GameErrorCode.E_SYSTEM_NO_OPEN;
            return;
        }
        player.getModule(NewMonopolyMarketModule.class).changeInSystemId(eMonopolyMarketResType.OFFICE_NEW.getValue());
        NewMonopolyMarketProto.NewMonopolyMarketEnterOfficeReqMsg req = NewMonopolyMarketProto.NewMonopolyMarketEnterOfficeReqMsg.parseFrom(packet.getBytes());
        NewMonopolyMarketMgr.sendAppointActivityPacket(player.getUserId(), Protocol.C_CROSS_NEW_MONOPOLY_MARKET_OFFICE_ENTER, req.toBuilder());
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
